#include "ship.h"

//volley--------------------------------
//constructors-----------
voley::voley(){
	vol = list<shot>();
}
voley::voley(voley* vol){
	add(vol);
}
voley::~voley(){
}
//add--------------------
// adds a shot or voley
// to the current structure
//-----------------------
void voley::add(voley* v){
	list<shot>::iterator ittS;
	for(ittS = v->vol.begin(); ittS != v->vol.end(); ittS++){
		vol.push_back(*ittS);
	}
}
void voley::add(int d, int p){
	shot sht;
	sht.damage = d;
	sht.prob = p;
	vol.push_back(sht);
}
//size-------------------
// returns the size of the
// list
//-----------------------
int voley::size(){
	return vol.size();
}
//get/popTop-------------
// returns the first
// element. pop removes
// it as well
//-----------------------
shot voley::getTop(){
	return vol.front();
}
shot voley::popTop(){
        shot sht = vol.front();
	vol.pop_front();
        return sht;
}
//======================================
//batery--------------------------------
//constructors-----------
batery::batery(int _dam, int _nsht, int _acc, int _mxr, int _mnr, int _wgt, b_type tp){
	dam = _dam;
	acc = _acc;
	shots = _nsht;
	range[0] = _mnr;
	range[1] = _mxr;
	weight = _wgt;
}
batery::batery(batery* bat){
	batery(bat->dam, bat->shots, bat->acc, bat->range[1], bat->range[0], bat->weight, bt_fore);
}
batery::~batery(){
}
//shoot------------------
// creates a voley struct
// that contains the shots
// from this batery
//-----------------------
voley* batery::shoot(voley* prev){
	if(prev == NULL){
		prev = new voley();
	}
	for(int i = 0; i < shots; i++){
		prev->add(dam, acc);
	}
	return prev;
}
//======================================
/*
//engine--------------------------------
//constructors-----------
engine::engine(int pow, int bSpd){
	ePow = pow;
        baseSpeed = bSpd;
}
engine::~engine(){
}
//addWeight--------------
// increases the weight
// by the proper amount
//-----------------------
void engine::addWeight(int wgt){
	if(wgt > 0){
		eWgt += wgt;
	}
}
void engine::removeWeight(int wgt){
	eWgt -= wgt;
	if(eWgt < 0){
		eWgt = 0;
	}
}
//accesors---------------
// return a copy of the 
// proper value
//-----------------------
int engine::power(){
	return ePow;
}
int engine::speed(){
	return ePow/eWgt * baseSpeed;
}
int engine::eva(){
	return (ePow/eWgt) * 100;
}
*/
//======================================
//p_ship--------------------------------
//sontructor-------------
p_ship::p_ship() {
	p_ship(1,1);
}
p_ship::p_ship(int p, int s) {
	armor = 1;
	shield = 5;	
}
p_ship::~p_ship(){
    
}
p_ship::p_ship(int arm, int shd, int _ePow, int _eSpd){
    armor = arm;
    shield = shd;
}
//======================================
